package day_2022_4_to_7.day48;

import java.util.Scanner;

/**
 * 求最大连续bit数
 * @author haomin
 * @date 2022/05/06 20:55
 **/
public class Day11_2_MaxContinuousBit {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = in.nextInt();

        int total = 0;
        int maxBit = 0;
        while(num != 0){
            if((num & 1) == 1){
                total++;
            }else{
                total = 0;
            }
            maxBit = Math.max(maxBit,total);
            num = (num >> 1);
        }
        System.out.println(maxBit);
    }
}